package com.baseframe.oss.constant;

import lombok.Getter;

public interface BaseOssConstant {

    /**
     * 默认规则
     */
    String DEFAULT_UPLOAD_PATH = "/upload/{date_day}";

    /**
     * https://的长度
     */
    int HTTPS_Str_Length = 7;

    String REDIS_KEY = "base:resources:oss:";

    /**
     * 文件访问地址前缀
     */
    String PATH_START = "https://";


    public enum PathRule {
        DATE_DAY("yyyyMMdd","date_day"),//
        DATE_MONTH("yyyyMMddHHmmss","date_month"),//
        UNKNOWN("未知","未知"),
        ;

        PathRule(String pattern, String sign) {
            this.pattern = pattern;
            this.sign = sign;
        }

        @Getter
        private final String pattern;
        @Getter
        private final String sign;

        public static PathRule  getRole(String sign){

            for (PathRule value : values()) {

                if (value.getSign().equals(sign)){
                    return value;
                }
            }

            return UNKNOWN;
        }



    }
}
